package com.software.course.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.software.course.dao.TeacherDao;
import com.software.course.enity.Course;
import com.software.course.enity.File;
import com.software.course.enity.User;
import com.software.course.enity.query.TeacherQuery;
import com.software.course.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherDao teacherDao;

    @Override
    public List<User> listStu() {
        return teacherDao.listStu();
    }

    @Override
    public PageInfo<User> liseStuByName(TeacherQuery teacherQuery) {
        PageHelper.startPage(teacherQuery.getPageNum(),teacherQuery.getPageSize());
        return new PageInfo<User>(teacherDao.liseStuByName(teacherQuery));
    }

    @Override
    public List<Course> listCourse() {
        return teacherDao.listCourse();
    }

    @Override
    public File getFileByUserId(Integer id) {
            return teacherDao.getFileByUserId(id);
    }
}
